<template>
  <div class="con">
    <div class="contbox6_10">
      <p class="titlelist6_10">
        权益管理
        <span style="color: #999">&nbsp;&nbsp;/&nbsp;&nbsp;</span>{{titles}}
      </p>
      <div class="content">
        <el-form label-width="80px" class="forms" v-show="xi == 1">
          <el-form-item label="品牌名称" style="float: left; margin-left: 10px">
            <el-select
              :disabled="this.type != 0"
              v-model="value"
              placeholder="请选择品牌名称"
            >
              <el-option
                v-for="items in options"
                :key="items.channelUid"
                :label="items.channelName"
                :value="items.channelUid"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <div>
              <span>权益类型</span>
              <el-select
                :disabled="this.type != 0"
                v-model="vipType"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in vipTypeOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
          </el-form-item>
        </el-form>
        <div v-if="xi == 1 && value != ''" class="grade">
          <div style="float: left; width: 100vw;height: 40px;line-height: 40px;font-size: 16px;border-bottom: 1px solid #ccc;">
            <span class="dispose">配置权益特权</span>
          </div>
          <div class="title_con">
            <div class="title">
              <div class="title_son">等级</div>
              <div class="title_son1">等级名称</div>
              <div class="title_son1">开通金额</div>
              <div class="title_son1">奖励金额</div>
              <div v-if="vipType == 0" class="title_son1">刷卡分润</div>
              <div v-if="vipType == 0" class="title_son1">扫码分润</div>
              <div v-if="vipType == 1" class="title_son1">利润分润</div>
              <div class="title_son2" v-if="type != 2">操作</div>
            </div>
            <div class="title" v-for="(val, i) in mbrInfos" :key="i">
              <div class="title_son">v{{ val.level }}</div>
              <div class="title_son1">
                <el-input :disabled="disabled" :maxlength="10" v-model="val.name"></el-input>
              </div>
              <div class="title_son1">
                <el-input :maxlength="5"
                @input="value=>{val.openAmt=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}"
                :disabled="disabled" v-model="val.openAmt"></el-input
                ><span style="margin-left:5px">元</span>
              </div>
              <div class="title_son1">
                <el-input
                :maxlength="5"
                @input="value=>{val.buyMbrProf=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}"
                  :disabled="disabled"
                  v-model="val.buyMbrProf"
                ></el-input
                ><span style="margin-left:5px">元</span>
              </div>
              <div v-if="vipType == 0" class="title_son1">
                <el-input
                  :maxlength="5"
                  @input="value=>{val.cardProfRate=value.replace(/^\D*(\d*(?:\.\d{0,3})?).*$/g, '$1')}"
                  :disabled="disabled"
                  v-model="val.cardProfRate"
                ></el-input
                ><span style="margin-left:5px">%</span>
              </div>
              <div v-if="vipType == 0" class="title_son1">
                <el-input
                  :maxlength="5"
                  @input="value=>{val.qrProfRate=value.replace(/^\D*(\d*(?:\.\d{0,3})?).*$/g, '$1')}"
                  :disabled="disabled"
                  v-model="val.qrProfRate"
                ></el-input
                ><span style="margin-left:5px">%</span>
              </div>
              <div v-if="vipType == 1" class="title_son1">
                <el-input
                  :maxlength="5"
                  @input="value=>{val.leftProfRate=value.replace(/^\D*(\d*(?:\.\d{0,3})?).*$/g, '$1')}"
                  :disabled="disabled"
                  v-model="val.leftProfRate"
                ></el-input
                ><span style="margin-left:5px">%</span>
              </div>
              <div class="title_son2">
                <div class="add" v-if="i == 0 && type != 2" @click="add">
                  + 添加等级
                </div>
                <div
                  @click="del(i)"
                  v-if="i == mbrInfos.length - 1 && i != 0 && type != 2">
                  <img src="../../assets/images/del.png" />
                </div>
              </div>
            </div>
            
          </div>
          <div style="float: left; width:100%">
            <p>设置参数时，请参考以下说明：</p>
            <p></p>
            <p style="margin-top: 10px">
              1、开通金额：APP代理购买权益需要支付的费用
            </p>
            <p>2、奖励金额：购买权益APP代理的直属上级可以获取的奖励金额</p>
            <p>3、分润：各类POS交易按照交易额设置的分润比例</p>
          </div>
          <div style="float:left; width:100%;margin-top:20px">
              <el-button type="primary"  style=" margin-left: 40%"  @click="complete1()"
                >下一步</el-button
              >
              <el-button
                style=" margin-left: 10px"
                @click="cancel5()"
                >取消</el-button
              >
            </div>
        </div>

        <div class="grade" v-if="xi == 2">
          <div
            style="
              float: left;
              width: 100%;
              height: 40px;
              line-height: 40px;
              font-size: 16px;
              border-bottom: 1px solid #ccc;
            "
          >
            <span class="dispose">权益升级规则配置</span>
          </div>
          <div class="title_con">
            <div class="sj" style="display:flex">
              <div class="title_son">等级</div>
              <div class="title_son1" style="width: 440px;">交易金额</div>
              <div class="title_son1">终端开通数</div>
              <div class="title_son1">新增商户数</div>
              <div class="title_son1">新增下级数</div>
              <div class="title_son2" v-if="type != 2">操作</div>
            </div>
            <div
              style="width: 100%; float: left; min-height: 60px"
              v-for="(v, s) in mbrInfos"
              :key="s"
            >
              <div class="title_son">v{{ s + 1 }}</div>
              <div
                class="list"
                v-for="(vals, ins) in v.mbrAddInfos"
                :id="ins != 0 ? 'active' : ''"
                :key="ins"
              >
                <div class="title_son1" style="width: 440px;display:flex">
                  <el-input
                    :disabled="disabled"
                    
                  maxlength="10"
                    v-model="vals.beginAmt"
                    @input="value=>{vals.beginAmt=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}"
                  ></el-input>
                  <span>-</span>
                  <el-input
                  maxlength="10"
                  @input="value=>{vals.endAmt=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}"
                    :disabled="disabled"
                    v-model="vals.endAmt"
                  ></el-input>
                  <span style="margin-left:5px">元</span>
                </div>
                <div class="title_son1">
                  <el-input
                    :maxlength="7"
                    @input="value=>{vals.openDeviceCnt=value.replace(/[^\d]+/g,'')}"
                    :disabled="disabled"
                    v-model="vals.openDeviceCnt"
                  ></el-input>
                </div>
                <div class="title_son1">
                  <el-input
                    :maxlength="7"
                    @input="value=>{vals.openMerCnt=value.replace(/[^\d]+/g,'')}"
                    :disabled="disabled"
                    v-model="vals.openMerCnt"
                  ></el-input>
                </div>
                <div class="title_son1">
                  <el-input
                    :maxlength="7"
                    @input="value=>{vals.openSonOfficeCnt=value.replace(/[^\d]+/g,'')}"
                    :disabled="disabled"
                    v-model="vals.openSonOfficeCnt"
                  ></el-input>
                </div>
                <div class="title_son2" v-if="disabled!=true">
                  <div
                    class="add"
                    v-if="ins == 0 && type != 2"
                    @click="adds(v)">
                    + 添加等级
                  </div>
                  <div
                    @click="dels(s, ins)"
                    v-if="ins == v.mbrAddInfos.length - 1 && ins != 0 && type != 2 " >
                    <img src="../../assets/images/del.png" />
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div style="float: left; width:100%">
            <p>设置参数时，请参考以下说明：</p>
            <p></p>
            <p style="margin-top: 10px">1、交易金额：交易金额达成阶段升级规则</p>
            <p>2、终端开通数：当前品牌开通押金交易的终端数量；</p>
            <p>3、新增商户数：新增商户的数量，商户入网通过视为成功；</p>
            <p>4、新增下级数：新增直属下级代理的数量，邀请注册通过视为成功！</p>
            <p style="color: #fb932b">
              注:升级规则是通过交易的金额进行升级，如无任何交易信息无法触发升级规则
            </p>
          </div>
           <div style="float: left; width:100%">
             <el-button
                style=" margin-left: 40%"
                @click="cancel2()"
                >上一步</el-button
              >
              <el-button style="margin-left:10px" type="primary" @click="complete2()">下一步</el-button> 
              <el-button  style="margin-left: 10px"  @click="cancel5()" >取消</el-button>
            </div>
        </div>

        <div class="grade" v-if="xi == 3">
          <div
            style="
              float: left;
              width: 100%;
              height: 40px;
              line-height: 40px;
              font-size: 16px;
              border-bottom: 1px solid #ccc;"
          >
            <span class="dispose">图片配置</span>
          </div>
          <div class="title_con">
            <div class="title">
              <div class="title_son">等级</div>
              <div class="title_son1" style="width: 460px">banner图配置</div>
              <div class="title_son1" style="width: 460px">详情图配置</div>
            </div>
            <div
              @click="li(s)"
              style="float: left; margin-bottom: 20px"
              v-for="(v, s) in mbrInfos"
              :key="s"
            >
              <div class="title_son">v{{ s + 1 }}</div>
              <div class="title_son1 sonn" style="width: 440px">
                <el-upload
                  :class="mbrInfos[s].imgList[0].bannerImgs.banner"
                  :disabled="disabled"
                  :action="httpurl + '/api/fileUpload'"
                  list-type="picture-card"
                  :file-list="mbrInfos[s].imgList[0].bannerImgs"
                  :limit="1"
                  name="file"
                  accept=".jpg,.jpeg,.png,.JPG,.JPEG,.PNG"
                  :before-upload="beforeAvatarUpload"
                  :on-preview="handlePictureCardPreview"
                  :on-remove="handleRemove.bind(null, { index: s, data: v })"
                  :on-success="handleSuccess.bind(null, { index: s, data: v })"
                >
                  <i class="el-icon-plus"></i>
                </el-upload>
                <el-dialog :visible.sync="dialogVisible">
                  <img width="100%" :src="dialogImageUrl" alt="" />
                </el-dialog>
              </div>
              <div class="title_son1" style="width: 440px">
                <el-upload
                  :before-upload="beforeAvatarUpload1"
                  :class="mbrInfos[s].imgList[0].detailImgs.detail"
                  :disabled="disabled"
                  :action="httpurl + '/api/fileUpload'"
                  list-type="picture-card"
                  :file-list="mbrInfos[s].imgList[0].detailImgs"
                  :limit="1"
                  name="file"
                  accept=".jpg,.jpeg,.png,.JPG,.JPEG,.PNG"
                  :on-preview="handlePictureCardPreviews"
                  :on-remove="handleRemovee.bind(null, { index: s, data: v })"
                  :on-success="handleSuccesse.bind(null, { index: s, data: v })"
                >
                  <i class="el-icon-plus"></i>
                </el-upload>
                <el-dialog :visible.sync="dialogVisibles">
                  <img width="100%" :src="dialogImageUrls" alt="" />
                </el-dialog>
              </div>
            </div>
          </div>
          <div style="float: left; width:100%">
            <p>
              图片配置要求：banner尺寸345px*186px，详情页不做限制，图片不超过1M；
            </p>
          </div>
          <div style="float: left; width:100%">
            <el-button style="margin-left: 40%" @click="cancel3()"
              >上一步</el-button
            >
            <el-button style="margin-left:10px" type="primary" @click="list()"
              >完成</el-button
            >
            
            <el-button
              style=" margin-left: 10px"
              @click="cancel5()"
              >取消</el-button
            >
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
import https from "../../plugins/https.js"
export default {
  name: "route",
  data() {
    return {
      titles:"",
      uploadDisabled:"uploadDisabled",
      index: "",
      type: "",
      disabled: false,
      dialogImageUrls: "",
      dialogImageUrl: "",
      dialogVisible: false,
      dialogVisibles: false,
      bannerImgs: [],
      // 图片
      phone: [
        {
          banner: [],
          detail: [],
        },
      ],
      httpurl: this.GLOBAL.httpurl,
      // 权益类型
      vipTypeOptions: [
        // {
        //   value: 0,
        //   label: "交易推送",
        // },
        // {
        //   value: 1,
        //   label: "刷脸快捷",
        // },
      ],
      mbrInfoes: [
        {
          list: [
            {
              beginAmt: "",
              endAmt: "",
              openDeviceCnt: "",
              openMerCnt: "",
              openSonOfficeCnt: "",
            },
          ],
        },
        {
          list: [
            {
              beginAmt: "",
              endAmt: "",
              openDeviceCnt: "",
              openMerCnt: "",
              openSonOfficeCnt: "",
            },
          ],
        },
      ],
      vipType: "",
      tianjiae: 0,
      vji1: 0,
      contain: "",
      msgxitong: [],
      newMsgxitong: [],
      imageUrl: "",
      imageUrl1: "",
      checked: true,
      value: "",
      options: [],
      newData: [],
      xi: 1,
      msg: [
        {
          name: "升级规则",
          cl: false,
        },
        {
          name: "配置图片",
          cl: true,
        },
      ],
      type: 1,
      vji: 1,
      currentPage: 1, //默认显示第一页
      pageSize: 1, //默认每页显示10条
      totalNum: 0, //总页数
      formnum: 2,
      row: {},
      rowIndex: "",
      mbrInfos: [],
      level: 1,
      formnum1: 2,
      mbrAddInfos: [],
      tableData: [],
      multipleSelection: [],
      urltype: this.GLOBAL.httpurl,
    };
  },
  created() {
    
    https.queryDictList({type:"mbr_type"}).then(res=>{
        console.log(res.data.data)
        this.vipTypeOptions=res.data.data
      }).catch(err=>{})
      
    
  },
  mounted: function () {
    // debugger
    if (this.$route.query.type == "2") {
      this.titles="查看权益"
      this.vipType = this.$route.query.mbrType;
      
      this.value = this.$route.query.channelUid;
      this.disabled = true;
      this.officeUid = this.$route.query.officeUid;
      this.type = this.$route.query.type;
     
      this.pingpai();
      
      this.createds();
      this.mbrInfos = [];
      
    } else if (this.$route.query.type == "1") {
      this.titles="修改权益"
      this.vipType =this.$route.query.mbrType;
      this.value = this.$route.query.channelUid;
      this.type = this.$route.query.type;
      this.officeUid = this.$route.query.officeUid;
      this.pingpai();
      this.createds();

      this.mbrInfos = [];
    } else {
      this.titles="创建权益"
      this.type = 0;
      this.vipType = '0';
      this.mbrInfos = [
        {
          level: 1,
          name: "",
          mbrUid: "",
          openAmt: "",
          qrProfRate: "",
          cardProfRate: "",
          imgList: [
            {
              bannerImgs: [],
              detailImgs: [],
            },
          ],
          mbrAddInfos: [
            {
              beginAmt: "",
              endAmt: "",
              openDeviceCnt: "",
              openMerCnt: "",
              openSonOfficeCnt: "",
            },
          ],
          buyMbrProf: "",
          leftProfRate: "", //利润分润
        },
      ];
    }
    window.scrollTo(0, 0);
    var _this = this;
    
    _this.pingpai();
    // _this.xitong();
  },
  components: {
  
  },

  methods: {
    
    // 第一步添加
    add(val) {
      this.mbrInfos.push({
        level: ++this.level,
        name: "",
        openAmt: "",
        qrProfRate: "",
        cardProfRate: "",
        buyMbrProf: "",
        mbrAddInfos: [],
        imageUrl: "",
        imageUrl1: "",
        leftProfRate: "", //利润分润
      });
    },
    // 第一步删除
    del(i) {
      console.log(i);
      this.mbrInfos.splice(i, 1);
      this.level--;
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    beforeAvatarUpload1(file){
      const isJPG =
        file.type === "image/jpeg" ||
        file.type === "image/png" ||
        file.type === "image/jpg";
       if (!isJPG) {
       
        layer.open({
          content: "上传预览图片只能是 jpg、jpeg、png 格式!",
          skin: "msg",
          time: 2,
        });
         return false;
       }
    },
    // 图片上传检验
    beforeAvatarUpload(file) {
      let newName = file.name.substring(file.name.lastIndexOf("."));
      const isJPG =
        file.type === "image/jpeg" ||
        file.type === "image/png" ||
        file.type === "image/jpg";
      if (!isJPG) {
       
        layer.open({
          content: "上传预览图片只能是 jpg、jpeg、png 格式!",
          skin: "msg",
          time: 2,
        });
         return false;
      }  else {
        let that = this;
        const isSize = new Promise((resolve, reject) => {
          const _URL = window.URL || window.webkitURL;
          const img = new Image();
          img.onload = () => {
            let name =
              file.name.substring(0, file.name.lastIndexOf(".")) +
              "_" +
              img.width +
              "_" +
              img.height +
              newName;
            file = new File([file], name);
            const valid = this.$commit.ImageRestrictions(
              img.width,
              img.height,
              2
            );
            valid ? resolve() : reject();
          };
          img.src = _URL.createObjectURL(file);
        }).then(
          () => {
            return file;
          },
          () => {
            layer.open({
              content: "图片尺寸限制为345：186，大小不可超过1M",
              skin: "msg",
              time: 2,
            });
            return Promise.reject();
          }
        );
        return isSize;
      }
    },
    handlePictureCardPreviews(file) {
      this.dialogImageUrls = file.url;
      this.dialogVisibles = true;
    },
    //第一步的完成
    complete1() {
      if(this.$route.query.type!=2){
      for (var i = 0; i < this.mbrInfos.length; i++) {
        if (this.mbrInfos[i].name == "")
          return layer.open({
            content: "等级名称不能为空",
            skin: "msg",
            time: 2,
          });
        if (this.mbrInfos[i].openAmt == "")
          return layer.open({
            content: "开通金额不能为空",
            skin: "msg",
            time: 2,
          });
        if (this.mbrInfos[i].buyMbrProf == "")
          return layer.open({
            content: "奖励金额不能为空",
            skin: "msg",
            time: 2,
          });
        if (this.mbrInfos[i].cardProfRate == "" && this.vipType == "0")
          return layer.open({
            content: "刷卡分润不能为空",
            skin: "msg",
            time: 2,
          });
        if (this.mbrInfos[i].qrProfRate == "" && this.vipType == "0")
          return layer.open({
            content: "扫码分润不能为空",
            skin: "msg",
            time: 2,
          });
        if (this.mbrInfos[i].leftProfRate == "" && this.vipType == "1")
          return layer.open({
            content: "利润分润不能为空",
            skin: "msg",
            time: 2,
          });
        }
        https.saveUpdateCfg({oemUid: localStorage.getItem("uid"),
          channelUid: this.value,
          officeUid: "",
          mbrType: this.vipType,
          mbrInfos: this.mbrInfos,}).then((res) => {
          if (res.data.code == "0000") {
            this.mbrInfos = res.data.data.mbrInfos;
            this.vipType = res.data.data.mbrType;
            this.value = res.data.data.channelUid;
            this.mbrInfos.map(item=>{
              if(item.imgList[0].bannerImgs.length>0){
                item.imgList[0].bannerImgs.banner='disabled'
              }
              if(item.imgList[0].detailImgs.length>0){
                item.imgList[0].detailImgs.detail='disabled'
              }
            })
            this.xi = 2;
          } else {
            layer.open({
              content: res.data.msg,
              skin: "msg",
              time:  2, //1秒后自动关闭
            });
          }
        })
        .catch((err) => {});
      }else{
         this.xi = 2;
      }
    },
    // 回显
    createds() {
        https.vipSelMbrCfg({ oemUid: localStorage.getItem("uid"),
          officeUid: this.officeUid,
          channelUid: this.value,
          mbrType: this.vipType,}).then((res) => {
          if (res.data.code == "0000") {
            console.log(res.data.data.mbrInfos.length);
            this.level =
              res.data.data.mbrInfos[res.data.data.mbrInfos.length - 1].level;
            this.mbrInfos = res.data.data.mbrInfos;
            this.vipType = res.data.data.mbrType.toString();
            this.mbrInfos.map(item=>{
              if(item.imgList[0].bannerImgs.length>0){
                item.imgList[0].bannerImgs.banner='disabled'
              }
              if(item.imgList[0].detailImgs.length>0){
                item.imgList[0].detailImgs.detail='disabled'
              }
            })
            this.options.push({
              channelUid: res.data.data.channelUid,
              channelName: res.data.data.channelName,
            });
          } else {
            layer.open({
              content: res.data.msg,
              skin: "msg",
              time:  2, //1秒后自动关闭
            });
          }
        })
        .catch((err) => {});
    },
    // 添加等级
    adds(i) {
      i.mbrAddInfos.push({
        beginAmt: "",
        endAmt: "",
        openDeviceCnt: "",
        openMerCnt: "",
        openSonOfficeCnt: "",
      });
    },
    cancel2() {
      this.xi = 1;
      console.log(this.mbrInfos);
    },
    // 图片返回上一步
    cancel3() {
      this.xi = 2;
    },
    // 删除等级
    dels(s, ins) {
      this.mbrInfos[s].mbrAddInfos.splice(ins, 1);
    },
    cancel5() {
      this.$router.push("vipList");
    },
    // 第二步的完成
    complete2() {
      if(this.$route.query.type!=2){
      for (let j = 0; j < this.mbrInfos.length; j++) {
        for (let k = 0; k < this.mbrInfos[j].mbrAddInfos.length; k++) {
          if (this.mbrInfos[j].mbrAddInfos[k].beginAmt == "")
            return layer.open({
              content: "交易金额不能为空",
              skin: "msg",
              time: 2,
            });
          if (this.mbrInfos[j].mbrAddInfos[k].endAmt == "")
            return layer.open({
              content: "交易金额不能为空",
              skin: "msg",
              time: 2,
            });
          if (this.mbrInfos[j].mbrAddInfos[k].openDeviceCnt == "")
            return layer.open({
              content: "终端开通数不能为空",
              skin: "msg",
              time: 2,
            });
          if (this.mbrInfos[j].mbrAddInfos[k].openMerCnt == "")
            return layer.open({
              content: "新增商户数不能为空",
              skin: "msg",
              time: 2,
            });
          if (this.mbrInfos[j].mbrAddInfos[k].openSonOfficeCnt == "")
            return layer.open({
              content: "新增下级数不能为空",
              skin: "msg",
              time: 2,
            });
        }
      }
        https.saveUpdateRule({mbrInfos: this.mbrInfos,}).then((res) => {
          if (res.data.code == "0000") {
            // this.createds()
            this.xi = 3;
          } else {
            layer.open({
              content: res.data.msg,
              skin: "msg",
              time:  2, //1秒后自动关闭
            });
          }
        })
        .catch((err) => {});

      // this.xi=3
      }else{
        this.xi=3
      }
    },
    handleSuccess(obj, res, file) {
      this.index = obj.index;
      if (res.data.filePath) {
        this.mbrInfos[this.index].imgList[0].bannerImgs.push({
          url: res.data.filePath,
        });
        if(this.mbrInfos[this.index].imgList[0].bannerImgs.length>0){
           this.mbrInfos[this.index].imgList[0].bannerImgs.banner='disabled'
        }
      } else {
        return layer.open({
          content: "上传图片失败",
          skin: "msg",
          time: 2,
        });
      }
    },
    handleRemove(obj, res, file) {
      this.index = obj.index;
      this.mbrInfos[this.index].imgList[0].bannerImgs.splice(0, 1);
      this.mbrInfos[this.index].imgList[0].bannerImgs.banner=''
    },
    handleSuccesse(obj, res, file, fileList) {
      this.index = obj.index;
      if (res.data.filePath) {
        this.mbrInfos[this.index].imgList[0].detailImgs.push({
          url: res.data.filePath,
        });
        if(this.mbrInfos[this.index].imgList[0].detailImgs.length>0){
          this.mbrInfos[this.index].imgList[0].detailImgs.detail='disabled'
        }
      } else {
        return layer.open({
          content: "上传图片失败",
          skin: "msg",
          time: 2,
        });
      }
    },
    handleRemovee(obj) {
      this.index = obj.index;
      this.mbrInfos[this.index].imgList[0].detailImgs.splice(0, 1);
      this.mbrInfos[this.index].imgList[0].detailImgs.detail=''
    },
    li(s) {
      this.index = s;
    },
    // 第三步
    list() {
      console.log(this.mbrInfos);
      if(this.$route.query.type!=2){
      for (let b = 0; b < this.mbrInfos.length; b++) {
        console.log(this.mbrInfos[b].imgList);
        if (this.mbrInfos[b].imgList[0].bannerImgs.length == 0) {
          return layer.open({
            content: "banner图不能为空",
            skin: "msg",
            time: 2,
          });
        }
        if (this.mbrInfos[b].imgList[0].detailImgs.length == 0) {
          return layer.open({
            content: "详情图不能为空",
            skin: "msg",
            time: 2,
          });
        }
      }
        https.saveMbrPhoto({ channelUid: this.value,mbrInfos: this.mbrInfos}).then((res) => {
          if (res.data.code == "0000") {
            this.$router.push("vipList");
          } else {
            layer.open({
              content: res.data.msg,
              skin: "msg",
              time:  2, //1秒后自动关闭
            });
          }
        })
        .catch((err) => {});
      }else{
        this.$router.push("vipList");
      }
    },
    // 品牌
    pingpai() {
       var _this = this;
      let uid = localStorage.getItem("uid");
      if (uid) {
          https.vipMemberChannel({officeUid: uid}).then(function (d) {
            if (d.data.code == "0000") {
              _this.options = d.data.data;
            } else {
              layer.open({
                content: d.data.msg,
                skin: "msg",
                time:  2, //1秒后自动关闭
              });
            }
          })
          .catch(function (error) {
            //axios请求失败回调
            console.log(error);
          });
      }
    },
  },

};
</script>

<style scoped>
.con {
  position: relative;
}
/* 单独样式 */
.contbox6_10 {
  width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
  float: left;
}
.content {
  min-width: calc(100% - 40px);
  position: relative;
}
.forms {
  margin-top: 20px;
}

.huiyaun6_19 {
  width: 100%;
  float: left;
  z-index: 99;
}
.huiyauntop6_19 {
  width: 100%;
  float: left;
  font-size: 14px;
  margin-top: 30px;
  border-bottom: 1px solid #eee;
}
.huiyauntopli6_19 {
  width: 100px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  float: left;
  border: 1px solid #eee;
  border-radius: 5px;
}
.huiyauntoplitrue6_19 {
  background-color: #409eff;
  color: #fff;
}
.huiyauntoplifalse6_19 {
  background-color: #fff;
  color: #222;
}
.uitupian6_19 {
  width: 100%;
  float: left;
}
.uitupian6_19 li {
  width: 300px;
  float: left;
  position: relative;
  margin-left: 40px;
}

.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  margin-left: 35px;
  margin-top: 30px;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
.name > .el-input__inner {
  width: 100%;
}
>>> .el-input{
  width: 160px
}
>>> .el-input__inner{
  width: 160px
}
.grade {
  padding: 20px;
  min-height: 100%;
}
.dispose {
  display: inline-block;
  height: 40px;
  border-bottom: 2px solid #409eff;
}
.title {
  display: flex;
  min-height: 50px;
  width: 100%;
  float: left;
  /* overflow-x: auto; */
}
.sj {
  min-height: 50px;
  width: 100%;
  float: left;
  overflow-x: auto;
  border-bottom: 1px solid #ccc;
}
.list {
  /* width: 100% */
  display: flex;
  height: 50px;
}
.titles {
  margin-left: 128px;
  display: flex;
  float: left;
}
#sj .titles:nth-of-type(1) {
  margin-left: 0 !important ;
  display: flex;
  float: left;
}

.title_son {
  width: 128px;
  float: left;
  display: flex;
  line-height: 50px;
}
.title_son1 {
  width: 200px;
  float: left;
  display: flex;
  line-height: 50px;
}
.title_son2 {
  display: flex;
  width: 150px;
  float: left;
  line-height: 50px;
}
.title_con {
  background: #f9fafc;
  /* width: 100%; */
  min-height: 20px;
  float: left;
  padding: 20px;
  margin-top: 20px;
  margin-bottom: 30px;
}
#active {
  margin-left: 128px !important;
}
.add {
  cursor: pointer;
  color: #409eff;
}
.sonn /deep/.el-upload {
  width: 185px !important;
  height: 100px !important;
}
</style>
<style rel="stylesheet/scss">
  .disabled .el-upload--picture-card{
    display: none;
  }
</style>
